<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
	<head>
	    <base href="<%=basePath%>">
		<title>设置平台信息</title>
        <%@include file="../collect/meta.jsp"%>
  	<link rel="stylesheet" href="css/radius.css" type="text/css"></link>
  	<link rel="stylesheet" href="css/Inputstyle.css" type="text/css"></link>
  	<script type="text/javascript" src="${ctx}/js/returnTop.js"></script>
  	<style>
  		.tbinput{
			width: 180px;
			height: 25px;
			font-size: 14px;
			background-color:#FFFFCC;
		}
		td{
			height:60px;
		}
  	</style>
  	</head>
	<body lang="zh-cn">
	<div class="wrapper">	
       <c:import url="/collect/top.jsp"></c:import>
		<div class="main-container" id="main-container">
			<div class="main-container-inner">
				<c:import url="/collect/left.jsp"></c:import>
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<ul class="breadcrumb">
							<li><i class="icon-home home-icon"></i>微信管理</li>
							<li>设置平台信息</li>
						</ul>
					</div>
					<div class="page-content">
						<div class="row">
							<div class="col-xs-12">
				          		<form action="maccount!updateWeixin" name="updatewx" method="post">
				          		<div align="center">
						          <table>
				                    <tr>
				                      <td>&nbsp;</td>
				                      <td><div align="right"><label for="one">appId：&nbsp;</label></div></td>
				                      <td><input type="text" id="one" name="thirdact.appId" class="input" value="${thirdact.appId}"/></td>	                      </td>
				                      <td><div align="left" id="one"></div></td>
				                    </tr>
				                    <tr>
				                      <td>&nbsp;</td>
				                      <td><div align="right"><label for="two">appSecret：&nbsp;</label></div></td>
				                      <td><input type="text" id="two" name="thirdact.appSecret" class="input" value="${thirdact.appSecret}"/></td>		                      </td>
				                      <td><div align="left" id="two"></div></td>
				                    </tr>
				                    <tr>
				                      <td>&nbsp;</td>
				                      <td><div align="right"><label for="three">公众账号名称：&nbsp;</label></div></td>
				                      <td><input type="text" id="three"  name="thirdact.name"  class="input" value="${thirdact.name}" /></td>		                      </td>
				                      <td><div align="left" id="three"></div></td>
				                    </tr>
				                    <tr>
				                      <td>&nbsp;</td>
				                      <td><div align="right"><label for="fover">公众帐号微信号：&nbsp;</label></div></td>
				                      <td><input type="text" id="fover" name="thirdact.weixinName" class="input" value="${thirdact.weixinName}"/></td>		                      </td>
				                      <td><div align="left" id="fover"></div></td>
				                    </tr>
				                    <tr>
				                      <td>&nbsp;</td>
				                      <td><div align="right"><label for="five">微信账号原始ID：&nbsp;</label></div></td>
				                      <td><input type="text" id="five"  name="thirdact.ysId" class="input" value="${thirdact.ysId}"/></td>		                      </td>
				                      <td><div align="left" id="five"></div></td>
				                    </tr>
				                    <tr>
				                      <input type="hidden" id="actid" name="thirdact.id" value="${thirdact.id}" />
				                      <input type="hidden" name="thirdact.createTime" value="${thirdact.createTime }" />
				                      <input type="hidden"  name="thirdact.eaId" value="${thirdact.eaId }"/>
				                      <td>&nbsp;</td>
				                      <td><div align="right">
						              	<input type="button" class="btn btn-primary radius"  id="but" value="提交"/>
						                	&nbsp;&nbsp;
						              </div></td>
				                      <td>
				                      	<a href="${ctx }/account/weixinurlexplain.jsp" class="btn btn-success radius">微信公众帐号对接教程</a>
				                      </td>
				                      <td>&nbsp;</td>
				                    </tr>
				                  </table>
				                  </div>
				                </form>
							</div>
						</div>
					</div>
				</div>
			</div>
			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse" style="position:fixed;bottom:0;">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div>
		<div class="push"></div>
     </div>
     <c:import url="/collect/down.jsp"></c:import>
	<script type="text/javascript">
		$(document).ready(function(){
			$(document).ready(function(){
				var sub = true;
				$("input[id='five']").change(function(){
					var five = $("input[id='five']").val();
					var six = $("input[id='actid']").val();
					$.ajax({
			            type: "POST",
			            url: "maccount!verifyYsId",
			            data: {ysId:five, actid:six},
			            dataType: "json",
			            success: function(data){
			            	var d = eval("("+ data+ ")");
			            	if (d != null) {
			            		alert(d.temp);
			            		sub = false;
							}else {
								sub = true;
							}
			            },
			            error : function(request) {
							alert("Connection error");
						}
			         });
				});
				
				$("#but").click(function(){
					var one = $("input[id='one']").val();
					if(one.length==0){
						alert("appId必填");
						return false;
					}
					var two = $("input[id='two']").val();
					if(two.length==0){
						alert("appSecret必填");
						return false;
					}
					var three = $("input[id='three']").val();
					if(three.length==0){
						alert("公众账号名称必填");
						return false;
					}
					var fover = $("input[id='fover']").val();
					if(fover.length==0){
						alert("公众帐号微信号必填");
						return false;
					}
					var five = $("input[id='five']").val();
					if(five.length==0){
						alert("微信账号原始ID必填");
						return false;
					}
					
					if (sub) {
						updatewx.submit();
					}
					
				});
			});
		});
		
		//防收回；企业微信信息：$查看平台信息
		$(document).ready(function(){
				$('.weixinguanli > ul').show();
				$('.weixinguanli > ul > li > a').eq(0).css("color","red");
			});
	</script>
  </body>
</html>